<template>
  <div class="table-box">
    <Editor ref="waRef" :isShowEditSet="false" :isShowLou="false" @save="submit" :base-info="baseInfo"></Editor>
  </div>
</template>

<script setup lang="ts">
import Editor from "@/components/Editor/index.vue";
import { onBeforeMount, reactive } from "vue";
import { getPrivate, editPrivate } from "@/api/modules/countrySetting";
import { ElMessage } from "element-plus";
import { useRouter } from "vue-router";

const router = useRouter();
const baseInfo = reactive({ author: "", title: "", cont: "" });

const submit = async (val: any) => {
  await editPrivate(val);
  ElMessage.success("成功");
  router.back();
};

const getInfo = async () => {
  const { data } = await getPrivate();
  baseInfo.title = (data as any).title;
  baseInfo.cont = (data as any).cont;
};

onBeforeMount(() => {
  Promise.all([getInfo()]);
});
</script>

<style></style>
